package codej.ast;

import static codej.ast.Option.*;

import java.util.*;

import codej.ast.*;

public class UnaryExpression extends Expression {

	private String sign;
	private Expression expression;
	private Primary primary;
	private List<Selector> selectors;
	private String plusOrMinus;

	public void accept(Visitor visitor) {
		visitor.visit(this);
	}

	public UnaryExpression(String sign, Expression expression) {
		this.sign = sign;
		this.expression = expression;
	}

	public UnaryExpression(Primary primary, List<Selector> selectors, String plusOrMinus) {
		this.primary = primary;
		this.selectors = selectors;
		this.plusOrMinus = plusOrMinus;
	}

	public boolean hasSign() {
		return null != sign;
	}

	public Expression getExpression() {
		return option(expression, new Expression());
	}

	public String getSign() {
		return sign;
	}

	public boolean hasPrimary() {
		return null != primary;
	}

	public Primary getPrimary() {
		return option(primary, new Primary(""));
	}

	public List<Selector> getSelectors() {
		return option(selectors, new LinkedList<Selector>());
	}

	public String getPlusOrMinus() {
		return option(plusOrMinus, "");
	}

}
